home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-30 | 2.4 KB | 108 lines | [TEXT/CWIE] |
- /*
- File: CMultiDialogs.cp
-
- Contains: Subclass of CDialogs which offer multiple pages
-
- Written by: Arno Gourdol
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
- */
-
- #include "CMultiDialogs.h"
- #include "assert.h"
-
- #include <Resources.h>
-
-
-
- // --------------------------------------------------------------------
- // CMultiDialog
- // --------------------------------------------------------------------
- // Constructor
-
- CMultiDialog::CMultiDialog(SInt16 dialogID, UInt16 commonItems, FontCode fontCode) :
- fDialogPane(-1),
- fCommonItems(commonItems),
- CDialog(dialogID, fontCode)
- {
-
- }
-
-
-
- // --------------------------------------------------------------------
- // CMultiDialog
- // --------------------------------------------------------------------
- // Destructor
-
- CMultiDialog::~CMultiDialog(void)
- {
-
- }
-
-
-
- // --------------------------------------------------------------------
- // ItemHit
- // --------------------------------------------------------------------
- // Calls ItemHit(pane, itemHit)
-
- void CMultiDialog::ItemHit(short itemHit)
- {
- ItemHit(GetDialogPane(), itemHit);
- }
-
-
-
- // --------------------------------------------------------------------
- // ItemHit
- // --------------------------------------------------------------------
-
- void CMultiDialog::ItemHit(UInt16 pane, short itemHit)
- {
- #pragma unused(pane, itemHit)
- }
-
-
-
- // --------------------------------------------------------------------
- // SetDialogPane
- // --------------------------------------------------------------------
- // Switch to the designated pane.
- // Creates a dialog if none exist
- // Saves parameters from current pane
- // Prepare the items in the dialog, including parameter subsitution
-
- void CMultiDialog::SetDialogPane(SInt16 pane)
- {
- if (GetWindowRef() == NULL)
- CreateWindow();
-
- if (GetDialogPane() != pane)
- {
- // Save parameters in current panel
- for (int i = 0; i < kDialogParametersCount; i++)
- {
- if (fParameters[i].dialogItem != 0)
- GetItemText(fParameters[i].dialogItem, fParameters[i].value);
- }
-
- // Remove items from current dialog
- if (fDialogPane > 0)
- ShortenDITL(GetDialogRef(),
- CountDITL(GetDialogRef()) - fCommonItems);
-
- fDialogPane = pane;
-
- {
- // Add new dialog items to the dialog
- Handle items = GetResource('DITL', GetDialogPane());
- assert(items != NULL);
- AppendDITL(GetDialogRef(), items, overlayDITL);
- ReleaseResource(items);
- }
-
- // Prepare the items in the dialog
- DoPrepareDialog();
- }
- }